<?php
class UsersController extends AppController {

	var $name = 'Users';
	
	function login() {
		// login automagic
		if ($this->Session->read('Auth.User')) {
			$this->Session->setFlash(__('U bent al ingelogd.', true));
			$this->redirect($this->Auth->loginRedirect);
		}
	}
	
	function logout() {
		$this->User->id = $this->Session->read('Auth.User.id');
		$this->User->saveField('last_login', date('Y-m-d H:i:s'));
		$this->Session->setFlash(__('U bent succesvol uitgelogd.', true));
		$this->redirect($this->Auth->logout());
	}
	
	function updates() {
		$updates = $this->User->get_updates();
		$this->set(compact('updates'));
	}
}
?>
